package com.kexio.user.dto;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.kexio.auth.dto.RoleInfo;
import com.kexio.common.excel.annotation.ExcelField;
import com.kexio.common.excel.annotation.ExcelSheet;
import com.kexio.common.page.PageQuery;

import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;

/**
 * 用户统一DTO
 * 
 * 支持用户的全部功能：
 * - 创建、更新、响应（通过验证分组区分）
 * - 分页查询（继承PageQuery）
 * - Excel导入导出（通过Excel注解）
 * 
 * 真正做到一个实体一个DTO，避免DTO泛滥
 * 
 * @author Kexio Team
 * @since 1.0.0
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
@ExcelSheet(
    name = "用户列表",
    headerHeight = 25,
    rowHeight = 20,
    headerBgColor = "79,129,189",
    headerFontColor = "255,255,255",
    freezeRows = 1
)
public class UserDTO extends PageQuery implements Serializable {
    
    private static final long serialVersionUID = 1L;
    
    // ==================== 验证分组接口 ====================
    
    /**
     * 创建用户验证分组
     */
    public interface CreateGroup {}
    
    /**
     * 更新用户验证分组
     */
    public interface UpdateGroup {}
    
    /**
     * 个人信息更新验证分组
     */
    public interface ProfileGroup {}
    
    // ==================== 基本字段 ====================
    
    /**
     * 用户ID（响应时使用）- UUID字符串
     */
    private String userId;
    
    /**
     * 租户ID
     */
    private String tenantId;
    
    /**
     * 用户名
     */
    @NotBlank(message = "用户名不能为空", groups = CreateGroup.class)
    @Size(min = 2, max = 64, message = "用户名长度必须在2-64个字符之间", groups = {CreateGroup.class, UpdateGroup.class})
    @Pattern(regexp = "^[a-zA-Z0-9_-]+$", message = "用户名只能包含字母、数字、下划线和连字符", groups = {CreateGroup.class, UpdateGroup.class})
    @ExcelField(value = "用户名", index = 0, width = 20, required = true)
    private String username;
    
    /**
     * 密码（创建时必填，更新时可选）
     */
    @NotBlank(message = "密码不能为空", groups = CreateGroup.class)
    @Size(min = 6, max = 32, message = "密码长度必须在6-32个字符之间", groups = {CreateGroup.class, UpdateGroup.class})
    private String password;
    
    /**
     * 确认密码（创建时使用）
     */
    @NotBlank(message = "确认密码不能为空", groups = CreateGroup.class)
    private String confirmPassword;
    
    /**
     * 昵称
     */
    @Size(max = 64, message = "昵称长度不能超过64个字符", groups = {CreateGroup.class, UpdateGroup.class, ProfileGroup.class})
    @ExcelField(value = "真实姓名", index = 1, width = 15, required = true)
    private String nickname;
    
    /**
     * 手机号
     */
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确", groups = {CreateGroup.class, UpdateGroup.class, ProfileGroup.class})
    @ExcelField(value = "手机号", index = 2, width = 15)
    private String phone;
    
    /**
     * 邮箱
     */
    @Email(message = "邮箱格式不正确", groups = {CreateGroup.class, UpdateGroup.class, ProfileGroup.class})
    @Size(max = 128, message = "邮箱长度不能超过128个字符", groups = {CreateGroup.class, UpdateGroup.class, ProfileGroup.class})
    @ExcelField(value = "邮箱", index = 3, width = 25)
    private String email;
    
    /**
     * 邮箱验证码（仅用于注册，不用于管理员创建用户）
     */
    private String emailCode;
    
    /**
     * 头像URL
     */
    @Size(max = 512, message = "头像URL长度不能超过512个字符", groups = {CreateGroup.class, UpdateGroup.class, ProfileGroup.class})
    private String avatarUrl;
    
    /**
     * 部门ID
     */
    private String deptId;
    
    /**
     * 部门名称（响应时使用）
     */
    @ExcelField(value = "部门", index = 5, width = 20)
    private String deptName;
    
    /**
     * 用户状态：1-启用，0-禁用
     */
    @ExcelField(value = "状态", index = 6, width = 10, readConverterExp = "启用=1,禁用=0", exportConverterExp = "1=启用,0=禁用")
    private Integer status;
    
    /**
     * 状态描述（响应时使用）
     */
    private String statusText;
    
    /**
     * 角色ID列表
     */
    private List<String> roleIds;
    
    /**
     * 角色信息列表（响应时使用）
     */
    private List<RoleInfo> roles;
    
    /**
     * 用户描述/备注
     */
    @Size(max = 500, message = "用户描述长度不能超过500个字符", groups = {CreateGroup.class, UpdateGroup.class})
    @ExcelField(value = "备注", index = 8, width = 30)
    private String description;
    
    // ==================== 安全相关字段 ====================
    
    /**
     * 是否被锁定
     */
    private Boolean isLocked;
    
    /**
     * 锁定时间
     */
    private LocalDateTime lockTime;
    
    /**
     * 解锁时间
     */
    private LocalDateTime unlockTime;
    
    /**
     * 密码错误次数
     */
    private Integer passwordErrorCount;
    
    /**
     * 最后登录时间
     */
    private LocalDateTime lastLoginTime;
    
    /**
     * 最后登录IP地址
     */
    private String lastLoginIp;
    
    /**
     * 密码过期时间
     */
    private LocalDateTime passwordExpireAt;
    
    /**
     * 最后密码修改时间
     */
    private LocalDateTime lastPasswordChangeAt;
    
    /**
     * 权限版本号
     */
    private Long permVersion;
    
    // ==================== 创建/更新控制字段 ====================
    
    /**
     * 是否需要强制修改密码（首次登录）
     */
    private Boolean forceChangePassword;
    
    /**
     * 密码过期天数（0表示不过期）
     */
    private Integer passwordExpireDays;
    
    /**
     * 是否发送欢迎邮件
     */
    private Boolean sendWelcomeEmail;
    
    /**
     * 是否发送欢迎短信
     */
    private Boolean sendWelcomeSms;
    
    /**
     * 是否解锁用户（仅当用户被锁定时有效）
     */
    private Boolean unlock;
    
    /**
     * 是否重置密码错误次数
     */
    private Boolean resetPasswordErrorCount;
    
    /**
     * 是否更新最后登录时间为当前时间
     */
    private Boolean updateLastLoginTime;
    
    // ==================== 审计字段 ====================
    
    /**
     * 创建时间
     */
    @ExcelField(value = "创建时间", index = 7, width = 20, dateFormat = "yyyy-MM-dd HH:mm:ss", importField = false)
    private LocalDateTime createdAt;
    
    /**
     * 更新时间
     */
    private LocalDateTime updatedAt;
    
    /**
     * 创建者ID
     */
    private String createdBy;
    
    /**
     * 创建者名称
     */
    private String createdByName;
    
    /**
     * 更新者ID
     */
    private String updatedBy;
    
    /**
     * 更新者名称
     */
    private String updatedByName;
    
    // ==================== 响应专用字段 ====================
    
    /**
     * 是否在线
     */
    private Boolean isOnline;
    
    /**
     * 活跃会话数量
     */
    private Integer activeSessionCount;
    
    /**
     * 扩展属性（JSON格式）
     */
    private String extendedProperties;
    
    // ==================== 操作字段 ====================
    
    /**
     * 操作者备注
     */
    @Size(max = 200, message = "操作者备注长度不能超过200个字符", groups = {CreateGroup.class, UpdateGroup.class})
    private String operatorNote;
    
    // ==================== 查询专用字段 ====================
    
    /**
     * 创建时间范围 - 开始时间（查询用）
     */
    private LocalDateTime createdAtStart;
    
    /**
     * 创建时间范围 - 结束时间（查询用）
     */
    private LocalDateTime createdAtEnd;
    
    /**
     * 最后登录时间范围 - 开始时间（查询用）
     */
    private LocalDateTime lastLoginStart;
    
    /**
     * 最后登录时间范围 - 结束时间（查询用）
     */
    private LocalDateTime lastLoginEnd;
    
    /**
     * 角色ID（查询拥有指定角色的用户）
     */
    private String roleId;
    
    /**
     * 角色编码（查询拥有指定角色的用户）
     */
    private String roleCode;
    
    /**
     * 权限编码（查询拥有指定权限的用户）
     */
    private String permissionCode;
    
    /**
     * 包含已删除用户（默认false，查询用）
     */
    private Boolean includeDeleted;
    
    /**
     * 仅查询在线用户（查询用）
     */
    private Boolean onlineOnly;
    
    /**
     * 数据权限过滤（是否启用数据权限，查询用）
     */
    private Boolean enableDataScope;
    
    // ==================== 构造函数 ====================
    
    public UserDTO() {
        this.status = 1; // 默认启用
        this.forceChangePassword = false;
        this.passwordExpireDays = 0;
        this.sendWelcomeEmail = false;
        this.sendWelcomeSms = false;
    }
    
    public UserDTO(String username, String nickname) {
        this();
        this.username = username;
        this.nickname = nickname;
    }
    
    // ==================== 静态工厂方法 ====================
    
    /**
     * 创建用于新增用户的DTO
     */
    public static UserDTO forCreate(String username, String password, String nickname) {
        UserDTO dto = new UserDTO(username, nickname);
        dto.password = password;
        dto.confirmPassword = password;
        return dto;
    }
    
    /**
     * 创建用于更新用户的DTO
     */
    public static UserDTO forUpdate() {
        return new UserDTO();
    }
    
    /**
     * 创建用于个人信息更新的DTO
     */
    public static UserDTO forProfile() {
        return new UserDTO();
    }
    
    /**
     * 从用户实体创建响应DTO
     */
    public static UserDTO fromEntity(com.kexio.user.entity.User user) {
        if (user == null) {
            return null;
        }
        
        UserDTO dto = new UserDTO();
        dto.userId = user.getId();
        dto.tenantId = user.getTenantId();
        dto.username = user.getUsername();
        dto.nickname = user.getNickname();
        dto.phone = user.getPhone();
        dto.email = user.getEmail();
        dto.avatarUrl = user.getAvatarUrl();
        dto.deptId = user.getDeptId();
        dto.status = user.getStatus();
        dto.isLocked = user.getIsLocked();
        dto.lockTime = user.getLockTime();
        dto.unlockTime = user.getUnlockTime();
        dto.passwordErrorCount = user.getPasswordErrorCount();
        dto.lastLoginTime = user.getLastLoginTime();
        dto.lastLoginIp = user.getLastLoginIp();
        dto.passwordExpireAt = user.getPasswordExpireAt();
        dto.lastPasswordChangeAt = user.getLastPasswordChangeAt();
        dto.permVersion = user.getPermVersion();
        dto.description = user.getDescription();

        return dto;
    }
    
    // ==================== 便捷方法 ====================
    
    /**
     * 判断密码是否一致
     */
    public boolean isPasswordMatch() {
        return password != null && password.equals(confirmPassword);
    }
    
    /**
     * 判断是否有手机号
     */
    public boolean hasPhone() {
        return phone != null && !phone.trim().isEmpty();
    }
    
    /**
     * 判断是否有邮箱
     */
    public boolean hasEmail() {
        return email != null && !email.trim().isEmpty();
    }
    
    /**
     * 判断是否有头像
     */
    public boolean hasAvatar() {
        return avatarUrl != null && !avatarUrl.trim().isEmpty();
    }
    
    /**
     * 判断是否有部门
     */
    public boolean hasDept() {
        return deptId != null && !deptId.trim().isEmpty();
    }
    
    /**
     * 判断是否有角色
     */
    public boolean hasRoles() {
        return roleIds != null && !roleIds.isEmpty();
    }
    
    /**
     * 判断用户是否为启用状态
     */
    public boolean isEnabled() {
        return Integer.valueOf(1).equals(status);
    }
    
    /**
     * 判断用户是否为激活状态
     */
    public boolean isActive() {
        return Integer.valueOf(1).equals(status) && !Boolean.TRUE.equals(isLocked);
    }
    
    /**
     * 判断用户是否被锁定
     */
    public boolean isUserLocked() {
        return Boolean.TRUE.equals(isLocked);
    }
    
    /**
     * 判断密码是否已过期
     */
    public boolean isPasswordExpired() {
        return passwordExpireAt != null && LocalDateTime.now().isAfter(passwordExpireAt);
    }
    
    /**
     * 判断是否设置了密码过期
     */
    public boolean hasPasswordExpire() {
        return passwordExpireDays != null && passwordExpireDays > 0;
    }
    
    /**
     * 获取角色数量
     */
    public int getRoleCount() {
        return hasRoles() ? roleIds.size() : 0;
    }
    
    /**
     * 判断是否有扩展属性
     */
    public boolean hasExtendedProperties() {
        return extendedProperties != null && !extendedProperties.trim().isEmpty();
    }
    
    /**
     * 获取脱敏后的手机号
     */
    public String getMaskedPhone() {
        if (phone == null || phone.length() < 11) {
            return phone;
        }
        return phone.substring(0, 3) + "****" + phone.substring(7);
    }
    
    /**
     * 获取脱敏后的邮箱
     */
    public String getMaskedEmail() {
        if (email == null || !email.contains("@")) {
            return email;
        }
        String[] parts = email.split("@");
        if (parts[0].length() <= 2) {
            return email;
        }
        return parts[0].substring(0, 2) + "***@" + parts[1];
    }
    
    /**
     * 验证请求参数
     */
    public void validate() {
        if (username != null) {
            username = username.trim();
        }
        
        if (nickname == null || nickname.trim().isEmpty()) {
            nickname = username;
        } else {
            nickname = nickname.trim();
        }
        
        if (phone != null) {
            phone = phone.trim();
            if (phone.isEmpty()) {
                phone = null;
            }
        }
        
        if (email != null) {
            email = email.trim().toLowerCase();
            if (email.isEmpty()) {
                email = null;
            }
        }
        
        if (avatarUrl != null) {
            avatarUrl = avatarUrl.trim();
            if (avatarUrl.isEmpty()) {
                avatarUrl = null;
            }
        }
        
        if (description != null) {
            description = description.trim();
            if (description.isEmpty()) {
                description = null;
            }
        }
        
        if (status == null) {
            status = 1;
        }
        
        if (passwordExpireDays == null) {
            passwordExpireDays = 0;
        }
    }
    
    /**
     * 判断是否有创建相关的必填字段
     */
    public boolean hasCreateRequiredFields() {
        return username != null && !username.trim().isEmpty() &&
               password != null && !password.trim().isEmpty() &&
               isPasswordMatch();
    }
    
    /**
     * 判断是否有任何更新内容
     */
    public boolean hasAnyUpdateFields() {
        return nickname != null || phone != null || email != null ||
               avatarUrl != null || deptId != null || status != null ||
               roleIds != null || description != null || passwordExpireDays != null ||
               unlock != null || resetPasswordErrorCount != null ||
               updateLastLoginTime != null || forceChangePassword != null ||
               extendedProperties != null;
    }
    
    // ==================== Getter/Setter ====================
    
    public String getUserId() {
        return userId;
    }
    
    public void setUserId(String userId) {
        this.userId = userId;
    }
    
    public String getTenantId() {
        return tenantId;
    }
    
    public void setTenantId(String tenantId) {
        this.tenantId = tenantId;
    }
    
    public String getUsername() {
        return username;
    }
    
    public void setUsername(String username) {
        this.username = username;
    }
    
    public String getPassword() {
        return password;
    }
    
    public void setPassword(String password) {
        this.password = password;
    }
    
    public String getConfirmPassword() {
        return confirmPassword;
    }
    
    public void setConfirmPassword(String confirmPassword) {
        this.confirmPassword = confirmPassword;
    }
    
    public String getNickname() {
        return nickname;
    }
    
    public void setNickname(String nickname) {
        this.nickname = nickname;
    }
    
    public String getPhone() {
        return phone;
    }
    
    public void setPhone(String phone) {
        this.phone = phone;
    }
    
    public String getEmail() {
        return email;
    }
    
    public void setEmail(String email) {
        this.email = email;
    }
    
    public String getEmailCode() {
        return emailCode;
    }
    
    public void setEmailCode(String emailCode) {
        this.emailCode = emailCode;
    }
    
    public String getAvatarUrl() {
        return avatarUrl;
    }
    
    public void setAvatarUrl(String avatarUrl) {
        this.avatarUrl = avatarUrl;
    }
    
    public String getDeptId() {
        return deptId;
    }
    
    public void setDeptId(String deptId) {
        this.deptId = deptId;
    }
    
    public String getDeptName() {
        return deptName;
    }
    
    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }
    
    public Integer getStatus() {
        return status;
    }
    
    public void setStatus(Integer status) {
        this.status = status;
    }
    
    public String getStatusText() {
        return statusText;
    }
    
    public void setStatusText(String statusText) {
        this.statusText = statusText;
    }
    
    public List<String> getRoleIds() {
        return roleIds;
    }
    
    public void setRoleIds(List<String> roleIds) {
        this.roleIds = roleIds;
    }
    
    public List<RoleInfo> getRoles() {
        return roles;
    }
    
    public void setRoles(List<RoleInfo> roles) {
        this.roles = roles;
    }
    
    public String getDescription() {
        return description;
    }
    
    public void setDescription(String description) {
        this.description = description;
    }
    
    public Boolean getIsLocked() {
        return isLocked;
    }
    
    public void setIsLocked(Boolean locked) {
        isLocked = locked;
    }
    
    public LocalDateTime getLockTime() {
        return lockTime;
    }
    
    public void setLockTime(LocalDateTime lockTime) {
        this.lockTime = lockTime;
    }
    
    public LocalDateTime getUnlockTime() {
        return unlockTime;
    }
    
    public void setUnlockTime(LocalDateTime unlockTime) {
        this.unlockTime = unlockTime;
    }
    
    public Integer getPasswordErrorCount() {
        return passwordErrorCount;
    }
    
    public void setPasswordErrorCount(Integer passwordErrorCount) {
        this.passwordErrorCount = passwordErrorCount;
    }
    
    public LocalDateTime getLastLoginTime() {
        return lastLoginTime;
    }
    
    public void setLastLoginTime(LocalDateTime lastLoginTime) {
        this.lastLoginTime = lastLoginTime;
    }
    
    public String getLastLoginIp() {
        return lastLoginIp;
    }
    
    public void setLastLoginIp(String lastLoginIp) {
        this.lastLoginIp = lastLoginIp;
    }
    
    public LocalDateTime getPasswordExpireAt() {
        return passwordExpireAt;
    }
    
    public void setPasswordExpireAt(LocalDateTime passwordExpireAt) {
        this.passwordExpireAt = passwordExpireAt;
    }
    
    public LocalDateTime getLastPasswordChangeAt() {
        return lastPasswordChangeAt;
    }
    
    public void setLastPasswordChangeAt(LocalDateTime lastPasswordChangeAt) {
        this.lastPasswordChangeAt = lastPasswordChangeAt;
    }
    
    public Long getPermVersion() {
        return permVersion;
    }
    
    public void setPermVersion(Long permVersion) {
        this.permVersion = permVersion;
    }
    
    public Boolean getForceChangePassword() {
        return forceChangePassword;
    }
    
    public void setForceChangePassword(Boolean forceChangePassword) {
        this.forceChangePassword = forceChangePassword;
    }
    
    public Integer getPasswordExpireDays() {
        return passwordExpireDays;
    }
    
    public void setPasswordExpireDays(Integer passwordExpireDays) {
        this.passwordExpireDays = passwordExpireDays;
    }
    
    public Boolean getSendWelcomeEmail() {
        return sendWelcomeEmail;
    }
    
    public void setSendWelcomeEmail(Boolean sendWelcomeEmail) {
        this.sendWelcomeEmail = sendWelcomeEmail;
    }
    
    public Boolean getSendWelcomeSms() {
        return sendWelcomeSms;
    }
    
    public void setSendWelcomeSms(Boolean sendWelcomeSms) {
        this.sendWelcomeSms = sendWelcomeSms;
    }
    
    public Boolean getUnlock() {
        return unlock;
    }
    
    public void setUnlock(Boolean unlock) {
        this.unlock = unlock;
    }
    
    public Boolean getResetPasswordErrorCount() {
        return resetPasswordErrorCount;
    }
    
    public void setResetPasswordErrorCount(Boolean resetPasswordErrorCount) {
        this.resetPasswordErrorCount = resetPasswordErrorCount;
    }
    
    public Boolean getUpdateLastLoginTime() {
        return updateLastLoginTime;
    }
    
    public void setUpdateLastLoginTime(Boolean updateLastLoginTime) {
        this.updateLastLoginTime = updateLastLoginTime;
    }
    
    public LocalDateTime getCreateTime() {
        return createdAt;
    }
    
    public void setCreateTime(LocalDateTime createdAt) {
        this.createdAt = createdAt;
    }
    
    public LocalDateTime getUpdateTime() {
        return updatedAt;
    }
    
    public void setUpdateTime(LocalDateTime updatedAt) {
        this.updatedAt = updatedAt;
    }
    
    public String getCreateBy() {
        return createdBy;
    }
    
    public void setCreateBy(String createdBy) {
        this.createdBy = createdBy;
    }
    
    public String getCreateByName() {
        return createdByName;
    }
    
    public void setCreateByName(String createdByName) {
        this.createdByName = createdByName;
    }
    
    public String getUpdateBy() {
        return updatedBy;
    }
    
    public void setUpdateBy(String updatedBy) {
        this.updatedBy = updatedBy;
    }
    
    public String getUpdateByName() {
        return updatedByName;
    }
    
    public void setUpdateByName(String updatedByName) {
        this.updatedByName = updatedByName;
    }
    
    public Boolean getIsOnline() {
        return isOnline;
    }
    
    public void setIsOnline(Boolean online) {
        isOnline = online;
    }
    
    public Integer getActiveSessionCount() {
        return activeSessionCount;
    }
    
    public void setActiveSessionCount(Integer activeSessionCount) {
        this.activeSessionCount = activeSessionCount;
    }
    
    public String getExtendedProperties() {
        return extendedProperties;
    }
    
    public void setExtendedProperties(String extendedProperties) {
        this.extendedProperties = extendedProperties;
    }
    
    public String getOperatorNote() {
        return operatorNote;
    }
    
    public void setOperatorNote(String operatorNote) {
        this.operatorNote = operatorNote;
    }
    
    public LocalDateTime getCreatedAtStart() {
        return createdAtStart;
    }
    
    public void setCreatedAtStart(LocalDateTime createdAtStart) {
        this.createdAtStart = createdAtStart;
    }
    
    public LocalDateTime getCreatedAtEnd() {
        return createdAtEnd;
    }
    
    public void setCreatedAtEnd(LocalDateTime createdAtEnd) {
        this.createdAtEnd = createdAtEnd;
    }
    
    public LocalDateTime getLastLoginStart() {
        return lastLoginStart;
    }
    
    public void setLastLoginStart(LocalDateTime lastLoginStart) {
        this.lastLoginStart = lastLoginStart;
    }
    
    public LocalDateTime getLastLoginEnd() {
        return lastLoginEnd;
    }
    
    public void setLastLoginEnd(LocalDateTime lastLoginEnd) {
        this.lastLoginEnd = lastLoginEnd;
    }
    
    public String getRoleId() {
        return roleId;
    }
    
    public void setRoleId(String roleId) {
        this.roleId = roleId;
    }
    
    public String getRoleCode() {
        return roleCode;
    }
    
    public void setRoleCode(String roleCode) {
        this.roleCode = roleCode;
    }
    
    public String getPermissionCode() {
        return permissionCode;
    }
    
    public void setPermissionCode(String permissionCode) {
        this.permissionCode = permissionCode;
    }
    
    public Boolean getIncludeDeleted() {
        return includeDeleted;
    }
    
    public void setIncludeDeleted(Boolean includeDeleted) {
        this.includeDeleted = includeDeleted;
    }
    
    public Boolean getOnlineOnly() {
        return onlineOnly;
    }
    
    public void setOnlineOnly(Boolean onlineOnly) {
        this.onlineOnly = onlineOnly;
    }
    
    public Boolean getEnableDataScope() {
        return enableDataScope;
    }
    
    public void setEnableDataScope(Boolean enableDataScope) {
        this.enableDataScope = enableDataScope;
    }
    
    @Override
    public String toString() {
        return "UserDTO{" +
                "userId=" + userId +
                ", tenantId='" + tenantId + '\'' +
                ", username='" + username + '\'' +
                ", password='[PROTECTED]'" +
                ", nickname='" + nickname + '\'' +
                ", phone='" + phone + '\'' +
                ", email='" + email + '\'' +
                ", avatarUrl='" + avatarUrl + '\'' +
                ", deptId='" + deptId + '\'' +
                ", status=" + status +
                ", isLocked=" + isLocked +
                ", roleCount=" + getRoleCount() +
                ", createdAt=" + createdAt +
                ", updatedAt=" + updatedAt +
                ", current=" + getCurrent() +
                ", size=" + getSize() +
                '}';
    }
}
